package com.example.number1.ui.theme;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.number1.R;


/**
 * 1、带数据跳转，和数据返回显示到页面
 * 2、四种启动模式前三种带数据跳转显示到页面
 * 3、写两app,其中一个app去启动另外一个app
 * 4、简单计算器，实现加减乘除功能
 */
public class DatatransmissionActivity2 extends AppCompatActivity implements View.OnClickListener {

    private Button viewById;
    private String str1;
    private TextView id;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_datatransmission2);

        Intent intent = getIntent();
        str1 = intent.getStringExtra("str1");

        id = findViewById(R.id.textnumber2);

        id.setText(str1);



        viewById = findViewById(R.id.number2);
        viewById.setOnClickListener(this);

    }


    @Override
    public void onClick(View v) {
        Intent intent = new Intent();

        Bundle bundle = new Bundle();
        bundle.putString("str2","1");

        intent.putExtras(bundle);

        setResult(Activity.RESULT_OK,intent);

        finish();
    }
}